// pages/index/index.js
Page({

    /**
     * 页面的初始数据
     */
    data: {
       
        currentItemId: 2,
        showfixed:false,
        top:0,
        img:[
'https://img10.360buyimg.com/babel/s700x360_jfs/t1/2882/22/6978/66609/5ba484dfEeccc826f/a1fa7d1b1fb91116.jpg!q90!cc_350x180',
            "https://img13.360buyimg.com/babel/s700x360_jfs/t1/702/11/13832/105745/5bd819ccE7d6eea66/c11edd086520145c.jpg!q90!cc_350x180",
            "http://img10.360buyimg.com/da/jfs/t1/3762/4/14114/108459/5bd9bddfE99f57027/eab81a8b3e90ebbe.jpg"
        ],
        imgUrls: [
            "https://img1.360buyimg.com/da/jfs/t25042/132/333384094/98130/508b4d2c/5b6c0505Nbb280bbc.jpg",
            "https://m.360buyimg.com/babel/jfs/t25147/143/379853961/89820/3076e2be/5b6d5dafNef6b6fcb.jpg"
        ],
        changeIndex:-1,
        show:false
    },
    changelist(e){
        console.log(e.currentTarget.dataset.index)
        this.setData({
            changeIndex:e.currentTarget.dataset.index,
            showfixed: true,
            show:true
        })
    },
    close(e){
        this.setData({
            changeIndex: -1,
            show: false
        })
        if(this.data.top<265){
        console.log("2232",this.data.top)
        this.setData({
           showfixed:false
        })
        }
    },
    submit(e){
        this.setData({
            changeIndex: -1,
            show: false
        })
    },
    /**
     * 生命周期函数--监听页面加载
     */
    onLoad: function (options) {

    },

    /**
     * 生命周期函数--监听页面初次渲染完成
     */
    onReady: function () {

    },
    onPageScroll(e){
        console.log(e)
        this.data.top = e.scrollTop
        if (this.data.top> 265 ){
            this.setData({
                showfixed:true
            })
        }
        if (this.data.top< 265 && !this.data.show){
            this.setData({
                showfixed: false
            })
        }
    },
    /**{}
     * 生命周期函数--监听页面显示
     */
    onShow: function () {

    },

    /**
     * 生命周期函数--监听页面隐藏
     */
    onHide: function () {

    },

    /**
     * 生命周期函数--监听页面卸载
     */
    onUnload: function () {

    },

    /**
     * 页面相关事件处理函数--监听用户下拉动作
     */
    onPullDownRefresh: function () {

    },

    /**
     * 页面上拉触底事件的处理函数
     */
    onReachBottom: function () {

    },

    /**
     * 用户点击右上角分享
     */
    onShareAppMessage: function () {

    }
})